package com.spa.interfaces.member;

import cn.dev33.satoken.annotation.SaIgnore;
import com.spa.application.command.member.MassagistCollectionAddCommand;
import com.spa.application.dto.PageResult;
import com.spa.application.dto.member.MemberCollectionDTO;
import com.spa.application.dto.member.MemberMassagistDTO;
import com.spa.application.dto.member.MemberMassagistDetailsDTO;
import com.spa.application.dto.member.MemberMassagistEvaluateDTO;
import com.spa.application.query.member.MemberMassagistDetailsQuery;
import com.spa.application.query.member.MemberMassagistEvaluateQuery;
import com.spa.application.query.member.MemberMassagistQuery;
import com.spa.application.service.member.MemberMassagistApplicationService;
import com.spa.application.service.member.MemberMyApplicationService;
import com.spa.infrastructure.common.ResponseMessage;
import com.spa.interfaces.BaseController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("member/massagist")
public class MemberMassagistController extends BaseController {

    @Resource
    private MemberMassagistApplicationService memberMassagistApplicationService;

    @Resource
    private MemberMyApplicationService memberMyApplicationService;

    /**
     * 技师-获取当前城市的全部技师
     * @param query
     * @return
     */
    @PostMapping("/listAll")
    @SaIgnore
    public ResponseMessage<PageResult<MemberMassagistDTO>> listAll(@RequestBody MemberMassagistQuery query) {
        return responseHelper.success(memberMassagistApplicationService.memberAllList(query));
    }

    /**
     * 技师-详情（二级页面）
     * @param query
     * @return
     */
    @PostMapping("/details")
    @SaIgnore
    public ResponseMessage<MemberMassagistDetailsDTO> details(@Validated @RequestBody MemberMassagistDetailsQuery query) {
        return responseHelper.success(memberMassagistApplicationService.memberDetails(query));
    }

    /**
     * 技师-顾客评价（二级页面）
     * @param query
     * @return
     */
    @PostMapping("/massagistEvaluatePage")
    @SaIgnore
    public ResponseMessage<PageResult<MemberMassagistEvaluateDTO>> massagistEvaluatePage(@RequestBody MemberMassagistEvaluateQuery query) {
        return responseHelper.success(memberMyApplicationService.pageMassagistEvaluate(query));
    }

    @PostMapping("/collection")
    public ResponseMessage<MemberCollectionDTO> collection(@Validated @RequestBody MassagistCollectionAddCommand command) {
        return responseHelper.success(memberMassagistApplicationService.collection(command));
    }

}
